<?php
namespace app\middleware;
use think\facade\Session;

class LoginCheck
{
    public function handle($request, \Closure $next)
    {
        // 富文本上传图片设置管理员权限
        if ($request->action() == 'kindupload'){
            session(config("auth.USER_AUTH_KEY"), 1);
        }
		if(!Session::has(config("auth.USER_AUTH_KEY"))){
			return redirect("/admin/Login/index");
		}
		define("ADMIN_ID",session(config("auth.USER_AUTH_KEY")));
        return $next($request);
    }
}
